package enterprises

import grails.test.*

class TypeConsumerTests extends GrailsUnitTestCase {
	
	TypeConsumer typeConsumer
	
    protected void setUp() {
        super.setUp()
		typeConsumer = new TypeConsumer()
		mockForConstraintsTests(TypeConsumer, [typeConsumer])
    }

    protected void tearDown() {
        super.tearDown()
    }

	void testNullableName() {
		assertFalse(typeConsumer.validate())
		assertEquals "nullable", typeConsumer.errors["name"]
	}
	
	void testEmptyName() {
		typeConsumer.name = ""
		
		assertFalse(typeConsumer.validate())
		assertEquals "blank", typeConsumer.errors["name"]
	}
	
	void testSmallName() {
		typeConsumer.name = "as"
		
		assertFalse(typeConsumer.validate())
		assertEquals "minSize", typeConsumer.errors["name"]
	}	
}
